/* 移动优先响应式设计 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 - 移动优先 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 25px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 卡片式布局 */
.fortune-form, .result-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.07);
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fortune-form:hover, .result-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 8px 20px rgba(0,0,0,0.1);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* 单选按钮样式 */
.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
    font-weight: 500;
}

.radio-label:hover {
    border-color: #cbd5e0;
    background: #f7fafc;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    accent-color: #667eea;
}

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

/* 错误消息样式 */
.error-message {
    display: block;
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 5px;
    min-height: 1.2rem;
}

/* 按钮样式 */
.submit-btn, .back-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.back-btn {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(113, 128, 150, 0.3);
}

/* 加载状态 */
.loading {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 增强的加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 页面过渡动画 */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* 表单输入动画 */
.form-group {
    position: relative;
}

.form-group input:focus + .input-highlight {
    transform: scaleX(1);
}

.input-highlight {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

/* 按钮点击反馈 */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* 表单提示样式 */
.optional {
    color: #718096;
    font-weight: 400;
    font-size: 0.85rem;
}

.form-hint {
    display: block;
    color: #718096;
    font-size: 0.8rem;
    margin-top: 4px;
    line-height: 1.4;
}

/* 结果页面样式 */
.user-info-card, .fortune-card, .lucky-card, .weather-card {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.2s ease;
}

.user-info-card:hover, .fortune-card:hover, .lucky-card:hover, .weather-card:hover {
    transform: translateY(-1px);
}

/* 天气卡片特殊样式 */
.weather-card {
    background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    border-color: rgba(56, 178, 172, 0.3);
}

.weather-card h2 {
    color: #234e52;
    border-bottom-color: #38b2ac;
}

.user-info-card h2, .fortune-card h2, .lucky-card h2, .weather-card h2 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

/* 天气信息样式 */
.weather-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 700;
    color: #38b2ac;
}

.weather-desc {
    font-size: 1.2rem;
    color: #2d3748;
    font-weight: 600;
}

.weather-details {
    display: grid;
    gap: 8px;
}

.weather-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(56, 178, 172, 0.2);
}

.weather-item:last-child {
    border-bottom: none;
}

.weather-label {
    font-weight: 600;
    color: #234e52;
}

.weather-update {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid rgba(56, 178, 172, 0.2);
}

.weather-update small {
    color: #4a5568;
}

/* 信息项样式 */
.info-item, .zodiac-item, .lucky-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.info-item:last-child, .zodiac-item:last-child, .lucky-item:last-child {
    border-bottom: none;
}

.label, .zodiac-label, .lucky-label {
    font-weight: 600;
    color: #4a5568;
}

.zodiac-value, .lucky-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

/* 生肖星座布局 */
.zodiac-info {
    display: grid;
    gap: 10px;
}

/* 运势内容 */
.fortune-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2d3748;
    text-align: justify;
    padding: 10px 0;
}

/* 幸运元素 */
.lucky-items {
    display: grid;
    gap: 10px;
}

/* 操作按钮区域 */
.actions {
    margin-top: 25px;
    text-align: center;
}
/* 平板设备
响应式设计 */
@media (min-width: 480px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    header p {
        font-size: 1.1rem;
    }
    
    .fortune-form, .result-container {
        padding: 35px;
    }
    
    .radio-group {
        gap: 20px;
    }
    
    .zodiac-info, .lucky-items {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

/* 桌面设备响应式设计 */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 30px;
    }
    
    header h1 {
        font-size: 3rem;
    }
    
    .fortune-form, .result-container {
        padding: 40px;
    }
    
    .form-group input[type="text"],
    .form-group input[type="date"] {
        font-size: 18px;
        padding: 16px 20px;
    }
    
    .submit-btn, .back-btn {
        font-size: 18px;
        padding: 18px 32px;
    }
    
    .radio-group {
        justify-content: center;
        gap: 30px;
    }
    
    .radio-label {
        flex: 0 0 auto;
        min-width: 120px;
    }
}

/* 大屏幕设备 */
@media (min-width: 1024px) {
    .container {
        max-width: 700px;
    }
    
    .fortune-form, .result-container {
        padding: 50px;
    }
    
    .result-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
        grid-template-areas: 
            "user-info fortune"
            "zodiac lucky"
            "actions actions";
    }
    
    .user-info-card {
        grid-area: user-info;
    }
    
    .fortune-card {
        grid-area: fortune;
    }
    
    .lucky-card {
        grid-area: lucky;
    }
    
    .actions {
        grid-area: actions;
        grid-column: 1 / -1;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .submit-btn:hover, .back-btn:hover,
    .fortune-form:hover, .result-container:hover,
    .user-info-card:hover, .fortune-card:hover, .lucky-card:hover {
        transform: none;
    }
    
    .radio-label, .submit-btn, .back-btn {
        min-height: 44px; /* 确保触摸目标足够大 */
    }
    
    .form-group input[type="text"],
    .form-group input[type="date"] {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 触摸反馈 */
    .submit-btn:active, .back-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .radio-label:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* 增强触摸区域 */
    .radio-label::before {
        content: '';
        position: absolute;
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
        z-index: -1;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .fortune-form, .result-container {
        background: white;
        border: 2px solid #000;
    }
    
    .user-info-card, .fortune-card, .lucky-card {
        background: #f0f0f0;
        border: 1px solid #666;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .fortune-form, .result-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .submit-btn, .back-btn {
        display: none;
    }
}